﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YhmOA.Common
{
    public class Units
    {
        #region 货币转英文
        /// <summary>
        /// 货币转英文
        /// </summary>
        /// <param name="value">要转换的内容</param>
        /// <returns></returns>
        public static string GetMoneyToEn(object value)
        {
            if (value.ToString() == "")
                return "";
            string result = MoneyToEn.Get().NumberToString(value.ToString());
            result = result.Replace("  ", " ").Replace("  ", " ").Replace("  ", " ");
            result = result.Replace("And Only", "Only");
            result = result.Replace("Cents", "");
            result = result.Replace("Point", "Cents");
            result = result.Replace("Cents", "And Cents");
            result = result.Replace("HundredAnd", "Hundred And");
            result = result.Replace("And And", "And");
            result = result.Replace("Cents One", "Cent One");
            return result;
        }
        #endregion

        #region 将货币转换成中文
        public static string GetMoneyToCn(object value)
        {
            if (value.ToString() == "")
                return "";
            string result = MoneyToCn.Get().ConvertSum(value.ToString());
            return result;
        }
        #endregion
    }
}
